package solution

import "math"

func V3(nums []int) int {
	max := nums[0]
	sum := 0

	for _, v := range nums {
		sum = int(math.Max(float64(sum+v), float64(v)))
		max = int(math.Max(float64(sum), float64(max)))
	}

	return max
}
